package model

type Art struct {
	ID              uint
	ContractAddress string
	BlockNumber     string
}

// TableName 会将 User 的表名重写为 `profiles`
func (Art) TableName() string {
	return "art"
}

type ChainExchange struct {
	ID                  uint
	TxHash              string
	BlockNumber         string
	BuyWalletAddress    string
	SellerWalletAddress string
	ContractAddress     string
	TokenID             uint
	ExchangeType        uint
}

// TableName 会将 User 的表名重写为 `profiles`
func (ChainExchange) TableName() string {
	return "chain_exchange"
}

type DeployParam struct {
	Owner   string `form:"owner" json:"owner" binding:"required"`
	Name    string `form:"name" json:"name" binding:"required"`
	BaseURI string `form:"baseURI" json:"baseURI" binding:"required"`
}

type DeployBatchParam struct {
	Items []DeployParam `form:"items" json:"items"`
}

type DeployResult struct {
	Address     string      `json:"address"`
	Transaction Transaction `json:"transaction"`
}

type Account struct {
	Address string `json:"address"`
	Balance string `json:"balance"`
}

// 交易结构体
type Transaction struct {
	TxHash      string `json:"txHash"`              // 交易的Hash
	Status      uint64 `json:"status,omitempty"`    // 交易状态 1为成功
	BlockNumber uint64 `json:"block,omitempty"`     // 所属区块高度
	Timestamp   uint64 `json:"timestamp,omitempty"` // 所属的区块时间

	From    string `json:"from,omitempty"`  // 发送者
	To      string `json:"to,omitempty"`    // 接收者
	Value   string `json:"value,omitempty"` // 交易中代币数量
	GasUsed uint64 `json:"gas,omitempty"`   // 交易消耗的Gas

	IsPending bool `json:"isPending"` // 是否为待确认的交易
}

// 区块结构体
type Block struct {
	BlockNumber uint64 `json:"blockNumber,omitempty"` // 区块高度
	BlockHash   string `json:"blockHash"`             // 区块哈希
	Timestamp   uint64 `json:"timestamp,omitempty"`   // 区块时间
	Txs         int    `json:"txs"`                   // 交易数量，查询区块链中所有交易有单独的接口
	Miner       string `json:"miner"`                 // 出块者地址
	Size        string `json:"size"`                  // 区块大小，这个数据经过显示格式处理
	GasUsed     uint64 `json:"gasUsed"`               // Gas消耗
	GasLimit    uint64 `json:"gasLimit"`              // Gas限制
}

type MintParams struct {
	Contract string `form:"contract" json:"contract" binding:"required"`
	Owner    string `form:"owner" json:"owner" binding:"required"`
	TokenURI string `form:"tokenURI" json:"tokenURI" binding:"required"`
}

type MintResult struct {
	TokenID     uint64      `json:"tokenID"`
	Transaction Transaction `json:"transaction"`
}

type MintBatchParamItem struct {
	Owner    string `form:"owner" json:"owner" binding:"required"`
	TokenURI string `form:"tokenURI" json:"tokenURI" binding:"required"`
}

type MintBatchParam struct {
	Contract string               `form:"contract" json:"contract" binding:"required"`
	Items    []MintBatchParamItem `form:"items" json:"items"`
}

type TransferFromParams struct {
	Contract string `form:"contract" json:"contract" binding:"required"`
	From     string `form:"from" json:"from" binding:"required"`
	To       string `form:"to" json:"to" binding:"required"`
	TokenID  uint64 `form:"tokenID" json:"tokenID" binding:"required"`
}

type TransferFromBatchParams struct {
	Items []TransferFromParams `form:"items" json:"items" binding:"required"`
}

type TransferResult struct {
	Transaction Transaction `json:"transaction"`
}

type TransferBatchResult struct {
	Transactions []*Transaction `json:"transactions"`
	Errors       []string       `json:"errors"`
}

type BurnParams struct {
	Contract string `form:"contract" json:"contract" binding:"required"`
	TokenID  uint64 `form:"tokenID" json:"tokenID" binding:"required"`
}

type GetTxInBlockParam struct {
	BlockNumber int64 `form:"blockNumber" json:"blockNumber" binding:"required"`
	TxIndex     uint  `form:"txIndex" json:"txIndex" binding:"required"`
}

type GetBlockParam struct {
	BlockNumber int64 `form:"blockNumber" json:"blockNumber" binding:"required"`
}
type GetBlockByHashParam struct {
	BlockHash string `form:"blockHash" json:"blockHash" binding:"required"`
}

type OwnerOfParam struct {
	Address string `form:"address" json:"address" binding:"required"`
	TokenID string `form:"tokenID" json:"tokenID" binding:"required"`
}
